Option Strict Off
Option Explicit On
Namespace BMLERP
	Friend Class FrmPOReport
		Inherits System.Windows.Forms.Form
		Dim ReportType As Short


		Private Sub CmdCancel_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdCancel.Click
			Reportflg = False
			Me.Close()
			Exit Sub
		End Sub

		Private Sub cmdPrint_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdPrint.Click
			If OptNonf.Checked = True Then
				Report.ReportFileName = DDAN & "\ReportPurchaseNoFinish.rpt"
				Report.RetrieveStoredProcParams()
				'    Report.StoredProcParam(0) = Trim(SPONo.Text)
				'    Report.StoredProcParam(1) = Trim(EPONo.Text)
				Report.Destination = Crystal.DestinationConstants.crptToWindow
				Report.Action = 1
			End If
			If OptPONo.Checked = True Then
				Report.ReportFileName = DDAN & "\ReportPurchaseOrder.rpt"
				Report.RetrieveStoredProcParams()
				Report.set_StoredProcParam(0, Trim(SPONo.CtlText))
				Report.set_StoredProcParam(1, Trim(EPONo.CtlText))
				Report.Destination = Crystal.DestinationConstants.crptToWindow
				Report.Action = 1
			End If
			If OptDate.Checked = True Then
				Report.ReportFileName = DDAN & "\PurchaseDate.rpt"
				Report.RetrieveStoredProcParams()
				Report.set_StoredProcParam(0, VB6.Format(Trim(TxtBdate.Text), "mm/dd/yyyy"))
				Report.set_StoredProcParam(1, VB6.Format(Trim(TxtEdate.Text), "mm/dd/yyyy"))
				Report.Destination = Crystal.DestinationConstants.crptToWindow
				Report.Action = 1
			End If
		End Sub

		Private Sub FrmPOReport_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
			Adodc1.ConnectionString = ConnectString
			Adodc1.ConnectionTimeout = 10
			Adodc1.CommandType = ADODB.CommandTypeEnum.adCmdText
			Adodc1.RecordSource = "Select OHPON from POH where isnumeric(OHPON)=1 and OHPOS<>'5' ORDER BY OHPON DESC"
			Adodc1.Refresh()
			EPONo.RowSource = Adodc1
			SPONo.RowSource = Adodc1
			OptPONo.Checked = False
			OptDate.Checked = False
			OptNonf.Checked = False
			Frame1.Enabled = False
			Frame2.Enabled = False
			OptPONo.Checked = True
			'    Reportflg = True


		End Sub

		Private Sub OptDate_CheckedChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles OptDate.CheckedChanged
			If eventSender.Checked Then
				OptPONo.Checked = False
				OptDate.Checked = True
				OptNonf.Checked = False
				TxtBdate.Text = ""
				TxtEdate.Text = ""
				SPONo.CtlText = ""
				EPONo.CtlText = ""
				Frame1.Enabled = True
				Frame2.Enabled = False
				'    ReportType = 2
				'    Frame1.Enabled = True
				'    Frame2.Enabled = False
				TxtBdate.Focus()
			End If
		End Sub

		Private Sub OptNonf_CheckedChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles OptNonf.CheckedChanged
			If eventSender.Checked Then
				OptPONo.Checked = False
				OptDate.Checked = False
				OptNonf.Checked = True
				TxtBdate.Text = ""
				TxtEdate.Text = ""
				SPONo.CtlText = ""
				EPONo.CtlText = ""
				Frame1.Enabled = False
				Frame2.Enabled = False
				'    ReportType = 3
				'    Frame1.Enabled = False
				'    Frame2.Enabled = False
				CmdPrint.Focus()
			End If
		End Sub

		Private Sub OptPONo_CheckedChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles OptPONo.CheckedChanged
			If eventSender.Checked Then
				TxtBdate.Text = ""
				TxtEdate.Text = ""
				SPONo.CtlText = ""
				EPONo.CtlText = ""
				Frame1.Enabled = False
				Frame2.Enabled = True
				OptPONo.Checked = True
				OptDate.Checked = False
				OptNonf.Checked = False
			End If
		End Sub

		Private Sub TxtBdate_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles TxtBdate.KeyPress
			Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
			If KeyAscii = 13 Then
				TxtEdate.Focus()
			ElseIf KeyAscii = 27 Then
				Reportflg = False
				Me.Close()

			End If
			eventArgs.KeyChar = Chr(KeyAscii)
			If KeyAscii = 0 Then
				eventArgs.Handled = True
			End If
		End Sub

		Private Sub TxtEdate_KeyPress(ByVal eventSender As System.Object, ByVal eventArgs As System.Windows.Forms.KeyPressEventArgs) Handles TxtEdate.KeyPress
			Dim KeyAscii As Short = Asc(eventArgs.KeyChar)
			If KeyAscii = 13 Then
				cmdPrint.Focus()
			ElseIf KeyAscii = 27 Then
				Reportflg = False
				Me.Close()

			End If
			eventArgs.KeyChar = Chr(KeyAscii)
			If KeyAscii = 0 Then
				eventArgs.Handled = True
			End If
		End Sub
	End Class
End Namespace